Next | Prev | Up | Top | Contents | Index

GIO-Specific Kernel Functions

Three GIO-specific functions are used in setting up a GIO device. They are only documented here; there are no reference pages for them. The functions are declared as external in the CPU-specific include files sys/IP20.h and sys/IP22.h. (When compiling for a POWER Indigo2, which uses an IP26 CPU, you include sys/IP22.h as well as sys/IP26.h.)


Function setgiovector()

The setgiovector() function registers an interrupt service function for a GIO device interrupt with the kernel's interrupt dispatcher, or unregisters one. The function prototype is

void setgiovector(int level, int slot, void (*func)(__psint_t, struct eframe_s *), __psint_t arg);

The arguments are as follows:

level The interrupt level; must be GIO_INTERRUPT_1 for all devices except the graphics board.
slot The slot number, 0 or 1.
func The address of the interrupt handling function (typically the pfxintr() entry point of the device driver), or else NULL to unregister.
arg A "pointer-sized integer" value to be passed as the first argument of the interrupt handler when it is invoked.

Note: If either the level or slot number is out of range, setgiovector() issues an error message with the CE_PANIC level, causing a kernel panic. When func is not NULL, the specified function is registered to receive interrupts at the given level from the given slot. When an interrupt occurs, the function is called with two arguments. The first is the value specified as arg, a "pointer-sized integer," typically the address of device-specific information. The second is the interrupt registers. The structure eframe_s is declared in sys/reg.h. However, this structure is of no interest.

This function can be used with a NULL for the func argument to unregister an interrupt routine that was previously registered. You must unregister an interrupt handler in a loadable device driver prior to unloading, when called at the pfxunload() entry point (see "Entry Point unload()").


Function setgioconfig()

The function setgioconfig() configures the GIO slot for a particular use. The function prototype is

void setgioconfig(int slot, int flags);

The arguments are as follows:

slot The slot number, 0 or 1.
flags A set of bit-flags from the constants GIO_ARB_* declared in sys/mc.h.

Note: If the slot number is out of range, setgioconfig() either issues an error message with the CE_PANIC level or suffers an assertion failure, causing a kernel panic. The flags that can be combined to make the flags argument are

GIO64_ARB_EXP0_SIZE_64Configure for 64-bit transfers; otherwise transfers will be 32-bit.
GIO64_ARB_EXP0_RTConfigure as a real-time device; otherwise it will be a long burst device.
GIO64_ARB_EXP0_MSTConfigure as a bus master; otherwise it will be a slave.
GIO64_ARB_EXP0_PIPEDConfigure slot as a pipelined device, otherwise it will be a non-pipelined device. For Indigo2 systems, this must be set.


Next | Prev | Up | Top | Contents | Index